import os 

xml_path='quiz_w8_data/annotations/xmls'

output_path='quiz_w8_data/annotations/'

image_index=[]

for root, dirs, files in os.walk(xml_path):  
    for file in files:  
        if os.path.splitext(file)[1] == '.xml':  
            image_index.append(os.path.splitext(file)[0])
            print(os.path.splitext(file)[0])

import random
random.shuffle(image_index)

f1 = open(output_path+'trainval.txt','w')
f2 = open(output_path+'test.txt','w')

for i in range(154):
    f1.write(str(image_index[i])+'\n')

for i in range(154,155):
    f2.write(str(image_index[i])+'\n')
